package com.emm.yixun.website.controller.estate;

import java.util.ArrayList;
import java.util.*;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.emm.yixun.common.model.ProjectHouseType;
import com.emm.yixun.common.model.User;
import com.emm.yixun.common.model.dto.ProjectHouseTypeDto;
import com.emm.yixun.common.response.ResponseList;
import com.emm.yixun.estate.service.ProjectHouseTypeServiceFacade;
import com.emm.yixun.website.common.utils.security.ShiroUtil;

@Controller
@RequestMapping("/estate/common/")
public class CommonController {
	@Autowired
	private ProjectHouseTypeServiceFacade projectHouseTypeServiceFacade;
	
	//查询户型
	@RequestMapping(value="findHouseTypes")
	@ResponseBody
    public Map<String,List<ProjectHouseType>>  findBatchHouseTypes(ProjectHouseTypeDto dto){
		Map<String,List<ProjectHouseType>> map=new HashMap<String,List<ProjectHouseType>>();
		User user=ShiroUtil.getCurrentUser();
		dto.setMerchantId(user.getMerchantId());
		ResponseList<ProjectHouseType> responseList= projectHouseTypeServiceFacade.findByDto(dto);
		if(responseList.isSuccess()){
			map.put("rows", responseList.getEntity());
			return map;
		}
		map.put("rows", new ArrayList<ProjectHouseType>());
		return map;
    }
}
